<template id="table1">
  <div>
    <table border="1">
      <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>密码</th>
        <th>操作</th>
      </tr>
      <tr v-for="index in list">
        <td v-for="value in index">{{value}}</td>
        <td>
<!--          <button @click="update(index)">修改</button></td>-->
      </tr>

    </table>
    <div>
      <form>
        id:<input  v-model="fuser" disabled/><br>
        姓名: <input  v-model="fuser.rname" disabled/><br>
        密码：<input  v-model="fuser.rname" disabled/><br>
        <button type="submit" @click="upd()">提交</button>
      </form>
    </div>
  </div>
</template>

<script>
export default {
  name: "UpdatePswd",
  data(){
    return{
      list:[],
      fuser:{name:"",password:""}
    }
  },
  components:{
    "table1":{
      template:"table1",
      props:{
        list:[],
        title:""
      }
    }
  },
  created() {
    this.$http.post('/author/select').then(data=>{
      this.list = data;
    })
  },
  methods:{
    // del(id){
    //   // alert(id);
    //   // var params = new URLSearchParams();
    //   // params.append('id', '70');
    //   this.author.id=id;
    //   alert(id);
    //   this.$http.post("/fuser/delete",this.author);
    //   //$.post("http://localhost:8080/texture/select");
    //   window.location.reload();
    // },
    upd(){
      this.$http.post("/fuser/updates",this.fuser).then(add=>{
        //alert(add);
        if(add>0){
          alert("修改成功");
          window.location.reload();
        }else{
          alert("修改失败")
        }
      });
    },
  }
}
</script>

<style scoped>

</style>
